{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Read files "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cudf as gd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = '/rapids/notebooks/srabhi/champs-2019/input/csv/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(4658147, 6) (2505542, 5)\n",
      "(2358657, 6)\n",
      "(4658147, 8)\n",
      "CPU times: user 784 ms, sys: 460 ms, total: 1.24 s\n",
      "Wall time: 2.57 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "train = gd.read_csv('%s/train.csv'%path)\n",
    "test = gd.read_csv('%s/test.csv'%path)\n",
    "print(train.shape,test.shape)\n",
    "test['scalar_coupling_constant'] = 0.0 \n",
    "for col in train.columns:\n",
    "    if train[col].dtype!='O':\n",
    "        train[col] = train[col].astype('float32')\n",
    "        if col in test.columns:\n",
    "            test[col] = test[col].astype('float32')\n",
    "struct = gd.read_csv('%s/structures.csv'%path)\n",
    "for col in struct.columns:\n",
    "    if struct[col].dtype!='O':\n",
    "        struct[col] = struct[col].astype('float32')\n",
    "print(struct.shape)\n",
    "contribs = gd.read_csv('%s/scalar_coupling_contributions.csv'%path)\n",
    "for col in contribs.columns:\n",
    "    if contribs[col].dtype!='O':\n",
    "        contribs[col] = contribs[col].astype('float32')\n",
    "print(contribs.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>molecule_name</th>\n",
       "      <th>atom_index_0</th>\n",
       "      <th>atom_index_1</th>\n",
       "      <th>type</th>\n",
       "      <th>fc</th>\n",
       "      <th>sd</th>\n",
       "      <th>pso</th>\n",
       "      <th>dso</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>83.022400</td>\n",
       "      <td>0.254579</td>\n",
       "      <td>1.25862</td>\n",
       "      <td>0.272010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.034700</td>\n",
       "      <td>0.352978</td>\n",
       "      <td>2.85839</td>\n",
       "      <td>-3.433600</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.032500</td>\n",
       "      <td>0.352944</td>\n",
       "      <td>2.85852</td>\n",
       "      <td>-3.433870</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.031900</td>\n",
       "      <td>0.352934</td>\n",
       "      <td>2.85855</td>\n",
       "      <td>-3.433930</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>83.022202</td>\n",
       "      <td>0.254585</td>\n",
       "      <td>1.25861</td>\n",
       "      <td>0.272013</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      molecule_name  atom_index_0  atom_index_1  type         fc        sd  \\\n",
       "0  dsgdb9nsd_000001           1.0           0.0  1JHC  83.022400  0.254579   \n",
       "1  dsgdb9nsd_000001           1.0           2.0  2JHH -11.034700  0.352978   \n",
       "2  dsgdb9nsd_000001           1.0           3.0  2JHH -11.032500  0.352944   \n",
       "3  dsgdb9nsd_000001           1.0           4.0  2JHH -11.031900  0.352934   \n",
       "4  dsgdb9nsd_000001           2.0           0.0  1JHC  83.022202  0.254585   \n",
       "\n",
       "       pso       dso  \n",
       "0  1.25862  0.272010  \n",
       "1  2.85839 -3.433600  \n",
       "2  2.85852 -3.433870  \n",
       "3  2.85855 -3.433930  \n",
       "4  1.25861  0.272013  "
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "contribs.head().to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>molecule_name</th>\n",
       "      <th>atom_index_0</th>\n",
       "      <th>atom_index_1</th>\n",
       "      <th>type</th>\n",
       "      <th>scalar_coupling_constant</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>84.807602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.257000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.0</td>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.254800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3.0</td>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2JHH</td>\n",
       "      <td>-11.254300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4.0</td>\n",
       "      <td>dsgdb9nsd_000001</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>84.807404</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    id     molecule_name  atom_index_0  atom_index_1  type  \\\n",
       "0  0.0  dsgdb9nsd_000001           1.0           0.0  1JHC   \n",
       "1  1.0  dsgdb9nsd_000001           1.0           2.0  2JHH   \n",
       "2  2.0  dsgdb9nsd_000001           1.0           3.0  2JHH   \n",
       "3  3.0  dsgdb9nsd_000001           1.0           4.0  2JHH   \n",
       "4  4.0  dsgdb9nsd_000001           2.0           0.0  1JHC   \n",
       "\n",
       "   scalar_coupling_constant  \n",
       "0                 84.807602  \n",
       "1                -11.257000  \n",
       "2                -11.254800  \n",
       "3                -11.254300  \n",
       "4                 84.807404  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head().to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>molecule_name</th>\n",
       "      <th>atom_index_0</th>\n",
       "      <th>atom_index_1</th>\n",
       "      <th>type</th>\n",
       "      <th>scalar_coupling_constant</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4658147.0</td>\n",
       "      <td>dsgdb9nsd_000004</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2JHC</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4658148.0</td>\n",
       "      <td>dsgdb9nsd_000004</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4658149.0</td>\n",
       "      <td>dsgdb9nsd_000004</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3JHH</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4658150.0</td>\n",
       "      <td>dsgdb9nsd_000004</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4658151.0</td>\n",
       "      <td>dsgdb9nsd_000004</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2JHC</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          id     molecule_name  atom_index_0  atom_index_1  type  \\\n",
       "0  4658147.0  dsgdb9nsd_000004           2.0           0.0  2JHC   \n",
       "1  4658148.0  dsgdb9nsd_000004           2.0           1.0  1JHC   \n",
       "2  4658149.0  dsgdb9nsd_000004           2.0           3.0  3JHH   \n",
       "3  4658150.0  dsgdb9nsd_000004           3.0           0.0  1JHC   \n",
       "4  4658151.0  dsgdb9nsd_000004           3.0           1.0  2JHC   \n",
       "\n",
       "   scalar_coupling_constant  \n",
       "0                       0.0  \n",
       "1                       0.0  \n",
       "2                       0.0  \n",
       "3                       0.0  \n",
       "4                       0.0  "
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test.head().to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Build coupling dataframe: \n",
    "- num_coupling, coupling_dim, molecule_name, atom_index_0, atom_index_1, coupling_type, scalar_coupling, fc, sd, pso, dso, id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_data = gd.concat([train, test])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [],
   "source": [
    "coupling_frame = gd.merge(all_data, contribs, on=['molecule_name', 'atom_index_0', 'atom_index_1', 'type'], how='left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "count = coupling_frame.groupby('molecule_name').count().reset_index()[['molecule_name', 'id']]\n",
    "count.columns = ['molecule_name', 'num_coupling']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "coupling_frame = coupling_frame.merge(count, on='molecule_name', how='left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "coupling_frame['coupling_dim'] = 9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>molecule_name</th>\n",
       "      <th>atom_index_0</th>\n",
       "      <th>atom_index_1</th>\n",
       "      <th>type</th>\n",
       "      <th>scalar_coupling_constant</th>\n",
       "      <th>fc</th>\n",
       "      <th>sd</th>\n",
       "      <th>pso</th>\n",
       "      <th>dso</th>\n",
       "      <th>num_coupling</th>\n",
       "      <th>coupling_dim</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>37536.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>13.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>3.367970</td>\n",
       "      <td>3.668420</td>\n",
       "      <td>-0.050646</td>\n",
       "      <td>0.178090</td>\n",
       "      <td>-0.427896</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>37537.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>13.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>95.123901</td>\n",
       "      <td>94.165497</td>\n",
       "      <td>0.246794</td>\n",
       "      <td>-0.341500</td>\n",
       "      <td>1.053090</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>37538.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>13.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>4.398760</td>\n",
       "      <td>4.659280</td>\n",
       "      <td>-0.062925</td>\n",
       "      <td>-0.334714</td>\n",
       "      <td>0.137114</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>37539.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>1.473030</td>\n",
       "      <td>1.456240</td>\n",
       "      <td>-0.042350</td>\n",
       "      <td>-0.015625</td>\n",
       "      <td>0.074767</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>37540.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2JHC</td>\n",
       "      <td>27.999201</td>\n",
       "      <td>28.251301</td>\n",
       "      <td>0.026271</td>\n",
       "      <td>-0.316717</td>\n",
       "      <td>0.038375</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>37541.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>14.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>0.800390</td>\n",
       "      <td>0.806692</td>\n",
       "      <td>-0.024683</td>\n",
       "      <td>-0.020428</td>\n",
       "      <td>0.038810</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>37542.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>14.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>2.224980</td>\n",
       "      <td>2.325440</td>\n",
       "      <td>0.017551</td>\n",
       "      <td>0.279645</td>\n",
       "      <td>-0.397658</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>37543.0</td>\n",
       "      <td>dsgdb9nsd_001714</td>\n",
       "      <td>14.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1JHC</td>\n",
       "      <td>106.818001</td>\n",
       "      <td>106.446999</td>\n",
       "      <td>0.302967</td>\n",
       "      <td>-1.070710</td>\n",
       "      <td>1.138660</td>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>37544.0</td>\n",
       "      <td>dsgdb9nsd_001715</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2JHC</td>\n",
       "      <td>-1.605580</td>\n",
       "      <td>-1.716980</td>\n",
       "      <td>0.055339</td>\n",
       "      <td>0.255334</td>\n",
       "      <td>-0.199271</td>\n",
       "      <td>47</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>37545.0</td>\n",
       "      <td>dsgdb9nsd_001715</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3JHC</td>\n",
       "      <td>1.823270</td>\n",
       "      <td>1.850450</td>\n",
       "      <td>0.049526</td>\n",
       "      <td>0.389146</td>\n",
       "      <td>-0.465847</td>\n",
       "      <td>47</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        id     molecule_name  atom_index_0  atom_index_1  type  \\\n",
       "0  37536.0  dsgdb9nsd_001714          13.0           2.0  3JHC   \n",
       "1  37537.0  dsgdb9nsd_001714          13.0           4.0  1JHC   \n",
       "2  37538.0  dsgdb9nsd_001714          13.0           5.0  3JHC   \n",
       "3  37539.0  dsgdb9nsd_001714          14.0           0.0  3JHC   \n",
       "4  37540.0  dsgdb9nsd_001714          14.0           1.0  2JHC   \n",
       "5  37541.0  dsgdb9nsd_001714          14.0           2.0  3JHC   \n",
       "6  37542.0  dsgdb9nsd_001714          14.0           4.0  3JHC   \n",
       "7  37543.0  dsgdb9nsd_001714          14.0           5.0  1JHC   \n",
       "8  37544.0  dsgdb9nsd_001715           7.0           1.0  2JHC   \n",
       "9  37545.0  dsgdb9nsd_001715           7.0           2.0  3JHC   \n",
       "\n",
       "   scalar_coupling_constant          fc        sd       pso       dso  \\\n",
       "0                  3.367970    3.668420 -0.050646  0.178090 -0.427896   \n",
       "1                 95.123901   94.165497  0.246794 -0.341500  1.053090   \n",
       "2                  4.398760    4.659280 -0.062925 -0.334714  0.137114   \n",
       "3                  1.473030    1.456240 -0.042350 -0.015625  0.074767   \n",
       "4                 27.999201   28.251301  0.026271 -0.316717  0.038375   \n",
       "5                  0.800390    0.806692 -0.024683 -0.020428  0.038810   \n",
       "6                  2.224980    2.325440  0.017551  0.279645 -0.397658   \n",
       "7                106.818001  106.446999  0.302967 -1.070710  1.138660   \n",
       "8                 -1.605580   -1.716980  0.055339  0.255334 -0.199271   \n",
       "9                  1.823270    1.850450  0.049526  0.389146 -0.465847   \n",
       "\n",
       "   num_coupling  coupling_dim  \n",
       "0            45             9  \n",
       "1            45             9  \n",
       "2            45             9  \n",
       "3            45             9  \n",
       "4            45             9  \n",
       "5            45             9  \n",
       "6            45             9  \n",
       "7            45             9  \n",
       "8            47             9  \n",
       "9            47             9  "
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "coupling_frame.head(10).to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [],
   "source": [
    "coupling_frame.to_csv('/rapids/notebooks/srabhi/champs-2019/input/parquet/baseline_coupling_frame.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
